package com.water_work_form.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.water_work_form.entity.RecordSynchronousComparison;
import com.water_work_form.entity.User;
import com.water_work_form.result.Result;
import com.water_work_form.result.ResultCodeEnum;
import com.water_work_form.result.ResultUtil;
import com.water_work_form.service.RecordSynchronousComparisonService;
import com.water_work_form.service.UserService;
import com.water_work_form.util.RandomIdUtil;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xuke
 * @since 2023-10-07
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    UserService userService;

    /**
     * 新增 用户信息
     * @param user
     * @return
     */
    @ApiOperation("新增")
    @PostMapping("/add")
    public Result addUser(@RequestBody User user){
        user.setId(RandomIdUtil.createRandomId());
        userService.save(user);
        return ResultUtil.success(ResultCodeEnum.SUCCESS, user);
    }

}

